package mock_or_enum;

public class 机器人能否返回原点_657 {
            public boolean judgeCircle(String moves) {
                int x = 0, y = 0;
                for(int i = 0; i < moves.length(); i++) {
                    switch(moves.charAt(i)){
                        case 'U':
                        y++;break;
                        case 'D':
                        y--;break;
                        case 'L':
                        x++;break;
                        case 'R':
                        x--;break;
                    }
                }
                return x==0 && y==0;
            }
        }